package servlet;

import eneity.Topic;
import service.UserManage;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class addTypeServlet extends HttpServlet {
    Topic topic=new Topic();
    UserManage um=new UserManage();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        topic.setTypaName(req.getParameter("topic"));
        int result = um.addTopic(topic);
        req.getRequestDispatcher("topicInfoServlet").forward(req,resp);
    }
}
